//
//  main.m
//  oc_29
//
//  Created by 楼楚 on 15/9/18.
//  Copyright (c) 2015年 Chu Lou. All rights reserved.
//

#import <Foundation/Foundation.h>
#define PATH @"/Users/louchu/code/oc_exercise"
int main(int argc, const char * argv[]) {
    @autoreleasepool {
       
        NSDictionary *dic = @{@"1":@"one",@"2":@"two",@"3":@"three"};
//        1.首先将字典转换成nsdata
        
        NSData *dicData = [NSArchiver archivedDataWithRootObject:dic];
        
        
        
//        2.把二进制文件写入我们的目标地址
        
        
//       BOOL ret =  [dicData writeToFile:[NSString stringWithFormat:@"%@/dic.plist"] atomically:YES];
//        if (ret) {
//            NSLog(@"success");
//            
//        }else{
//            NSLog(@"fail");
//        }
        
        
        NSData *data1 = [NSData dataWithContentsOfFile:[NSString stringWithFormat:@"%@/dic.plist",PATH]];
        id obj = [NSUnarchiver unarchiveObjectWithData:data1];
        NSLog(@"%@",obj);
        
        
    }
    return 0;
}
